﻿using Abp.Configuration.Startup;
using Abp.Localization.Dictionaries;
using Abp.Localization.Dictionaries.Xml;
using Abp.Reflection.Extensions;

namespace NetCore.Localization
{
    /// <summary>
    /// 资源文件配置类
    /// </summary>
    public static class NetCoreLocalizationConfigurer
    {
        public static void Configure(ILocalizationConfiguration localizationConfiguration)
        {
            //xml资源文件
            localizationConfiguration.Sources.Add(
                new DictionaryBasedLocalizationSource(NetCoreConsts.LocalizationSourceName,// 本地化资源名称
                    new XmlEmbeddedFileLocalizationDictionaryProvider(// 数据源提供者，这里使用的是 XML ，除了 XML 提供者，还有 JSON 等
                        typeof(NetCoreLocalizationConfigurer).GetAssembly(),
                        "NetCore.Localization.SourceFiles"
                    )
                )
            );
            ////Json资源文件
            //localizationConfiguration.Sources.Add(
            //    new DictionaryBasedLocalizationSource(NetCoreConsts.LocalizationSourceName,
            //        new JsonEmbeddedFileLocalizationDictionaryProvider(
            //            typeof(NetCoreLocalizationConfigurer).GetAssembly(),
            //            "NetCore.Core.Localization.SourceFiles"
            //        )
            //    )
            //);
        }
    }
}
